import {ref, watchEffect} from '@vue/runtime-core'

let app=document.querySelector("#app");
const title=ref("纯DOM完成渲染，只需要引入@vue/runtime-core");

function createRoot(){
  const root=document.createElement("div");
  const h1=document.createElement("h1");
  h1.innerHTML=title.value;
  const button=document.createElement("button");
  button.innerHTML="改变1";
  button.addEventListener("click",()=>{
    title.value=Math.random();
  });
  root.appendChild(h1);
  root.appendChild(button);
  return root;
}

watchEffect(()=>{
  app.innerHTML="";
  app.appendChild(createRoot());
});